# Hugging Face Download Tool Configuration (Windows)

# Default variables
HF_ENDPOINT = https://hf-mirror.com
SHELL = powershell.exe

# Main targets
.PHONY: help setup download-model download-dataset

help:
	@powershell -Command "Write-Host 'Windows HF Download Tool'"
	@powershell -Command "Write-Host 'Usage:'"
	@powershell -Command "Write-Host '  make setup                  - Setup environment'"
	@powershell -Command "Write-Host '  make download-model MODEL=model_name [OPTIONS]   - Download specified model'"
	@powershell -Command "Write-Host '  make download-dataset DATASET=dataset_name [OPTIONS] - Download specified dataset'"

setup:
	powershell -Command "[Environment]::SetEnvironmentVariable('HF_ENDPOINT', '$(HF_ENDPOINT)', 'User')"

download-model:
	@powershell -Command "if (-not '$(MODEL)') { Write-Host 'Error: MODEL parameter not specified'; exit 1 }"
	@powershell -Command "bash ./hfd.sh $(MODEL) $(if $(INCLUDE),--include $(INCLUDE),) $(if $(EXCLUDE),--exclude $(EXCLUDE),) $(if $(USERNAME),--hf_username $(USERNAME),) $(if $(TOKEN),--hf_token $(TOKEN),) $(if $(LOCAL_DIR),--local-dir $(LOCAL_DIR),) $(if $(REVISION),--revision $(REVISION),)"

download-dataset:
	@powershell -Command "if (-not '$(DATASET)') { Write-Host 'Error: DATASET parameter not specified'; exit 1 }"
	@powershell -Command "bash ./hfd.sh $(DATASET) --dataset $(if $(INCLUDE),--include $(INCLUDE),) $(if $(EXCLUDE),--exclude $(EXCLUDE),) $(if $(USERNAME),--hf_username $(USERNAME),) $(if $(TOKEN),--hf_token $(TOKEN),) $(if $(LOCAL_DIR),--local-dir $(LOCAL_DIR),) $(if $(REVISION),--revision $(REVISION),)"
